@layout("/common/_container.html"){
<style>
	.input-group{
		/*width:45%;*/
	}
	.row input[type=text],.form-control, .single-line{
	    width:35%;
        float:left;
    }
    .error{
        color:red;
        float:left;
        padding-top: 7px;
        padding-left: 10px;
    }
    .isShow label{
        padding-right:10px;
        padding-top:3px;
    }
	.input-group{
		width:60%;
		margin:0 auto;
	}
	.row input[type=text]{
	width:45%; 
    }
    .error{
        color:red;
    }
</style>
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal">

            <input type="hidden" id="adId" value="${item.adId}">
            <input type="hidden" id="positionTypeh" value="${item.positionType}">
            <input type="hidden" id="adPositionIdh" value="${item.adPositionId}">
            <input type="hidden" id="adStartDateh" value="${item.startDate}">
            <input type="hidden" id="adEndDateh" value="${item.endDate}">
            <input type="hidden" id="dataFlagh" value="${item.dataFlag}">

            <div class="row">
            				<#input id="adName" name="广告标题" value="${item.adName}" underline="false"/>
            				<#input id="adSort" name="排序号" value="${item.adSort}" underline="false"/>
            				<!-- <#avatar id="adFile" name="广告图片" underline="true" avatarImg="" value=""/> -->
                            <#Select id="dataFlag" name="前端是否显示" >
                                <option value="1">启用</option>
                                <option value="-1">禁用</option>
                            </#Select>
                			<#Select id="positionType" name="类型" value="${item.positionType}" >
                                <option value="-1">请选择</option>
                                <option value="1">PC版</option>
                                <option value="2">APP版</option>
                            </#Select>
            <#Select id="URLTypeE" name="链接类型" >
            <option value="0">请选择</option>
            <option value="1">内部链接</option>
            <option value="2">外部链接</option>
        </#Select>
            <div class="row" id="soNameD" style="display: none;">
                <!--<div class="col-sm-6">-->
                <!--<#input id="soName" name="名称" />-->
                <!--</div>-->
                <!--<div class="col-sm-3" style="width:270px">-->
                <!--<#button name="搜索" icon="fa-search" clickFun="search()"/>-->
                <!--</div>-->
                <div class="form-group">
                    <label class="col-sm-3 control-label">名称</label>
                    <div class="col-sm-3">
                        <input id="soName" type="text" class="form-control" style="width: 100%" disabled>
                    </div>
                    <div class="col-sm-3">
                        <button class="btn btn-primary " onclick="so()">  <i class="fa fa-search"></i>搜索</button>
                    </div>
                </div>
            </div>
            <div id="adURLD" style="display: none;">
                <#input id="adURL" name="广告网址" value="${item.adURL}" underline="false"/>
            </div>
                            <#TimeCon id="startDate" name="广告开始时间" isTime="false" pattern="YYYY-MM-DD" value="${item.adStartDate}" />
                            <#TimeCon id="endDate" name="广告结束时间" isTime="false" pattern="YYYY-MM-DD" value="${item.adEndDate}" />
                			<#Select id="adPositionId" name="广告位置" >
                                    <!--<option value="">请选择</option>-->
                            </#Select>
							<#avatar id="adFile" name="广告图片" underline="true" avatarImg="${item.adFile}"/>
            </div>

            <div class="row btn-group-m-t">
                <div class="col-sm-10" style="text-align:center;">
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="AdsInfoDlg.editSubmit()"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="AdsInfoDlg.close()"/>
                </div>
            </div>
        </div>

    </div>
</div>
<script src="${ctxPath}/static/modular/huamao/ads/ads_info.js"></script>

<script>
    var adUrl = $("#adURL").val();
    if(adUrl == "" || adUrl == null || adUrl == undefined){
        $("#URLTypeE").val(0);
    }else if(adUrl.substring(0,6) == "shopId"){
        //店铺
        $("#URLTypeE").val(1);
        $("#adURLD").hide();
        $("#soNameD").show();
    }else if(adUrl.substring(0,7) == "goodsId"){
        //商品
        $("#URLTypeE").val(1);
        $("#adURLD").hide();
        $("#soNameD").show();
    }else if(adUrl.substring(0,9) == "articleId"){
        //公告
        $("#URLTypeE").val(1);
        $("#adURLD").hide();
        $("#soNameD").show();
    }else{
        $("#URLTypeE").val(2);
        $("#soNameD").hide();
        $("#adURLD").show();
    }

    $("#URLTypeE").change(function () {
        if($("#URLTypeE").val() == 0){
            $("#soNameD").hide();
            $("#soName").val("");
            $("#adURLD").hide();
            $("#adURL").val("");

        }
        //1内部链接 2外部链接
        if($("#URLTypeE").val() == 2){
            $("#soNameD").hide();
            $("#soName").val("");
            $("#adURL").val("");
            $("#adURLD").show();
        };
        if($("#URLTypeE").val() == 1){
            $("#soName").val("");
            $("#soNameD").show();
            $("#adURLD").hide();
            $("#adURL").val("");
        };
    });

</script>
@}
